This contains the complete scene code for the scene titled “Robot Room.” Following this, the code is broken down into sections, with explanations of each section.
PRINT{The robot's body is too heavy to be moved. The robot is missing its head.}
IF{ROBOT.POWER>SCENE@}THEN
PRINT{There is a rectangular hole in the robot's chest. Some component seems to be missing.}
EXIT
EXIT
IF{ROBOT.POWER>SCENE@}THEN
PRINT{There is a rectangular hole in the robot's chest. Some component seems to be missing, perhaps the power supply.}
EXIT
PRINT{TOBOR: "Hey cut it out, that tickles!"}
EXIT
IF{TEXT$=TALK}THEN
PRINT{......................................}
IF{ROBOT.HEAD>SCENE@}THEN
PRINT{The robot can't talk, it doesn't have a head.}
EXIT
IF{ROBOT.POWER>SCENE@}THEN
PRINT{The robot is lifeless. It needs a power unit.}
EXIT
IF{T1#<1}THEN
PRINT{TOBOR: "Thanks for putting my head back, and restoring my power! I've been sitting there an awfully long time.}
PRINT{"My hoverskirt is still damaged though, so I can't move. But there's nothing you can do about that.}
PRINT{"By the way, I'm an object. Like the guy at the beginning of the game, my actions are controlled by the scene code. That's what allows me to talk to you. I can defend myself too, if you are so foolish as to attack me!}
PRINT{"But I'd much rather talk."}
LET{T1#=1}
EXIT
IF{T1#=1}THEN
PRINT{TOBOR: "Well let's see... oh yeah. I was supposed to tell you that only the full moon can provide the combination to the safe.}
PRINT{"I have no idea what that means. Ray just wanted me to tell you that. See, it's in the script.}
PRINT{"It's pretty boring just sitting here all the time. I wish Ray had given me a working hoverskirt."}
PRINT{"But it could be worse. At least I'm not stranded on a satellite and forced to watch bad movies. If I had to sit through Mitchell or Manos: The Hands of Fate, I'd tear my own head off!"}
LET{T1#=2}
EXIT
IF{T1#=2}THEN
PRINT{TOBOR: "If you see a rocket anywhere, you should say the magic word. For some reason that's pretty important.}
PRINT{"I don't remember what the magic word is. I'll have to search my data files and see if I can find it. Maybe by the time you talk to me again I might be able to remember it."}
LET{T1#=3}
EXIT
IF{T1#=3}THEN
PRINT{TOBOR: "Sorry, I still can't remember the magic word. But it's a four letter word that starts with H.}
PRINT{"And there should be some kind of clue about it in a nearby scene.}
PRINT{"One more thing you should know: A User Variable keeps track of my conversation with you, so that each time you talk to me I'll say something new, instead of the same thing over and over."}
LET{T1#=4}
EXIT
IF{T1#=4}THEN
PRINT{TOBOR: "Sorry, I've run out of things to say. I wish I was more like TV's wisecracking Crow, or the urbane Tom Servo. Those two are never at a loss for words!}
PRINT{"I especially wish I had Tom's singing voice! Not to mention his great dance moves. For a guy with a hoverskirt and useless arms, he sure can cut a rug!"}
LET{T1#=5}
EXIT
PRINT{TOBOR: "Sorry pal, I haven't heard anything new."}
EXIT
IF{TEXT$=OFFER}OR{TEXT$=GIVE}THEN
PRINT{......................................}
IF{ROBOT.HEAD>SCENE@}THEN
PRINT{The robot can't take anything from you, since it doesn't have a head.}
EXIT
IF{ROBOT.POWER>SCENE@}THEN
PRINT{The robot is lifeless and can't take anything from you.}
EXIT
IF{TEXT$=RAM}OR{TEXT$=CHIP}THEN
IF{RAMCHIP>PLAYER@}THEN
PRINT{TOBOR: "Hey, you don't have any RAMchips! Don't tease me like that!"}
EXIT
MOVE{RAMCHIP}TO{STORAGE@}
LET{X1#=10}
PRINT{TOBOR: "Wow, thanks pal! Man, I love those things! Here, let me give you a little something for that."}
PRINT{Tobor takes the RAMchip and swallows it eagerly, then hands you some coins. You now have $10!}
EXIT
PRINT{TOBOR: "No thanks, I couldn't really do anything with that. But I'd sure love some nice crunchy RAMchips!"}
EXIT
**************End of code*************************
In this scene, there is a robot body that is missing its head and power unit. The player must find and attach both the head and the unit. Then he can talk to the robot and receive important clues to the game. Each time the player talks to the robot, the robot will tell him something new, until the robot runs out of things to say. The player can also give a chip to the robot, and receive money from it in trade.
The first section of code handles the scene description. The description of the scene can be altered, depending on whether the robot has its head off, or is rebuilt and operating normally:
IF{LOOP#=0}OR{TEXT$=LOOK}THEN
PRINT{You are in another room, with a robot standing in the corner. There is an open doorway to the SOUTH, and the room continues to the EAST.}
IF{ROBOT.HEAD>SCENE@}THEN
PRINT{......................................}
PRINT{The robot's head is missing.}
END
IF{ROBOT.HEAD=SCENE@}AND{ROBOT.POWER=SCENE@}THEN
PRINT{......................................}
PRINT{TOBOR: "Welcome back, pal."}
END
PRINT{......................................}
PRINT{You are facing NORTH.}
END
>>>The first statement in the code above tests to see if the loop # is zero, meaning the player has just come into the scene; or that the player has entered the word “look.” If either of these conditions is true, then the beginning of the scene description is printed. Then a nested statement tests to see if the object that is a drawing of the robot’s head on its body is not in the scene. If this object is not in the scene, the statement is true, and text is printed telling the player that the head is not on the body.
Another nested statement tests two conditions. First, it checks to see if the robot’s head is on; then it checks to see if the power unit object is in the scene. The statement is true only if BOTH of these conditions are true. This means that the robot has its head and is fully powered and operable. If so then text is printed giving a greeting from the robot to the returning player. (We know the player has been here before, since only the player could have put the robot back together.)
Finally, the rest of the standard description is printed, telling the player which direction he is facing in this scene. Remember, if one or both of the nested statements is false, the false statements will be ignored, and only the text in the original IF/THEN statement is printed.<<<
The next section of code handles the verbs “use” and “put.” “Use is the standard command verb in games of this type, for times when the player wants to use an object in his or her inventory. In this case, there is a chance that some players might use the word “put” instead, as in “Put the head on the robot.” So, that word is added to this code, and is treated exactly the same as “use:”
IF{TEXT$=USE}OR{TEXT$=PUT}THEN
PRINT{......................................}
IF{TEXT$=HEAD}THEN
IF{HEAD=PLAYER@}THEN
SOUND{PISTOL-COCKING.1}
MOVE{ROBOT.HEAD}TO{SCENE@}
MOVE{HEAD}TO{STORAGE@}
PRINT{The robot's head locks into place.}
IF{ROBOT.POWER=SCENE@}THEN
SOUND{HELLO}
PRINT{The robot's eyes light up as soon as the head is in place, and the robot begins to speak.}
PRINT{TOBOR: "Oh thank God, that feels much better! It's so creepy being headless.}
PRINT{"I'm Tobor. Pleased to meet you, pal."}
EXIT
PRINT{However, the robot is still lifeless. It seems to lack power.}
EXIT
PRINT{The only head you have is your own. You should use it to find the robot's head!}
EXIT
IF{TEXT$=UNIT}THEN
IF{UNIT=PLAYER@}THEN
SOUND{PISTOL-COCKING.1}
MOVE{ROBOT.POWER}TO{SCENE@}
MOVE{UNIT}TO{STORAGE@}
PRINT{The power unit snaps into place, and the robot's body begins to hum softly as energy courses through it.}
IF{ROBOT.HEAD=SCENE@}THEN
SOUND{HELLO}
PRINT{The robot's eyes light up as soon as the power unit is in place, and the robot begins to speak.}
PRINT{However, nothing more happens. Perhaps if the robot had a head...}
EXIT
PRINT{You don't have the robot's power unit.}
EXIT
IF{TEXT$=RAM}OR{TEXT$=CHIP}THEN
PRINT{TOBOR: "Oh man, I'm dyin' for a nice crunchy RAMchip! But you can't install it yourself. I have to do it."}
EXIT
IF{TEXT$=ROBOT}THEN
PRINT{You can't take the robot anywhere. What do you want to do with it?}
EXIT
END
>>>The first statement in the code above tests for entry of the words “use” or “put.” If either of these words have been entered, then the first nested statement checks to see if the word “head” has also been entered. If this is true, then another statement tests to see if the player has the robot’s head. If this is also true, then the “head” object is moved to storage, and an immobile object representing the attached head is moved to the scene. A mechanical clicking sound it played, and text is printed that tells the player the head is now in place on the robot.
Since the robot can only come to life when both the head AND the power unit are in place, another statement tests to see if the unit has been installed. An immobile object called “ROBOT.POWER” is used to depict the installed unit. If it is in the scene, then additional text is printed, simulating the robot’s response as it is brought to life. If the unit has not been installed, that statement is ignored, and the rest of the “head” text is printed, telling the player that the robot still lacks power.
The next segment of the above code handles installation of the power unit. It is similar to the segment dealing with use of the head. A conditional statement tests for entry of the word “unit.” Another statement nested in that one tests to see if the player has the unit, and if so, moves the unit to storage and moves the ROBOT.POWER object to the scene. Then another statement tests to see if the head has already been installed, and if so, prints the robot’s response.
The third nested statement in the “use” statement tests for entry of the words “ram” or “chip.” This is in case the player tries to install the ramchip himself, instead of giving it to the robot. (Since the player can’t get to the chip until after the robot has been assembled, there is no need for another statement testing whether or not the robot has been assembled.) If the player has tried to “use” the chip, then text is printed, indicating that the robot wants the chip, but must install it himself.
Finally, the last statement nested in the “use/put” statement tests for entry of the word “robot.” This is in case the player tries to “use the robot,” in which case he is told that it is too heavy to move, and the player is prompted for a more specific action. The entire “use/put” statement closes with END, so that if the player tries to use some object other than these, the program will skip all the nested statements and continue to the Global code, where a default response tells the player, “That doesn’t work.”<<<
Next code section (below) handles any attempts to move or take things in the scene. It is pretty simple and self-explanatory. If the player tries to move the robot, he will be told it is too heavy. If he tries to take the head, AND the head is attached to the robot, he will be told to leave it on. The third nested statement checks to see if the player has entered the words “power” or “unit,” and if so, another statement within that one checks to see if it has been installed in the robot. If so, the player is told to leave it in place. If not, that statement is ignored, and the “power/unit” statement closes with END, so that the unit will be automatically moved to the player if the player is trying to pick up the unit after dropping it at the scene.
IF{TEXT$=GET}OR{TEXT$=TAKE}OR{TEXT$=MOVE}THEN
PRINT{......................................}
IF{TEXT$=ROBOT}OR{TEXT$=BODY}THEN
PRINT{The robot is too heavy to move.}
EXIT
IF{TEXT$=HEAD}AND{ROBOT.HEAD=SCENE@}THEN
PRINT{You should leave the robot's head on its body. It's no good to you otherwise.}
EXIT
IF{TEXT$=POWER}OR{TEXT$=UNIT}THEN
IF{ROBOT.POWER=SCENE@}THEN
PRINT{You have no other use for the power unit. Leave it in the robot.}
EXIT
END
END
The section below handles any attempt by the player to shoot the robot. Since the robot is actually an Object and not a Character, attacks must be handled with scene code:
IF{TEXT$=SHOOT}OR{TEXT$=FIRE}THEN
PRINT{......................................}
IF{PISTOL>PLAYER@}THEN
PRINT{You don't have a gun.}
EXIT
IF{ROBOT.HEAD>SCENE@}OR{ROBOT.POWER>SCENE@}THEN
PRINT{Don't shoot the robot, it may be useful to you later!}
EXIT
SOUND{RICOCHET}
PRINT{The bullet bounces off the robot's metal hide.}
PRINT{TOBOR: "Hey! What do you think you're doing, stinkweed?! Two can play at that game!}
SOUND{PULSE.2}
PRINT{The robot fires a pulse beam at you, which stuns you and gives you a nastly burn.}
SOUND{OUCH}
LET{PHYS.HIT.CUR#=PHYS.HIT.CUR#-30}
EXIT
>>>The first statement in the code above tests for use of the words “shoot” or “fire.” (Fire is the verb to use the pistol in the Weapons Menu.) If either word has been entered, then the first nested statement checks to see if the player has the pistol. If the pistol is not in the player’s possession, then text is printed telling him he does not have a gun, and the program stops there until the player’s next command. If the player does have the pistol, that statement is ignored and the program continues.
The next nested statement checks to see if both the head and the power unit have been installed in the robot. If either of these objects is not in the scene, then text is printed telling the player that he shouldn’t shoot the robot, since it may be useful after it is activated. The program stops there until the player’s next command. If BOTH the head and the unit are installed, then the statement is ignored and the program continues.
Now, having determined that the player has the pistol, and that the robot is activated, the attack is executed. First a sound is played of a ricochet, and text tells the player that his shot has merely bounced off the robot. Then the robot’s verbal response is printed. Finally, the sound of the robot’s weapon is played, and the player’s hit points are reduced as text is printed telling him he’s been injured by the robot’s attack. The player’s current hit points are represented by the variable PHYS.HIT.CUR#
The entire statement closes with EXIT, and the program stops until the player’s next command (or click).<<<
This is followed by a brief section of code that handles the player’s attempts to use other weapons against the robot, such as fists or throwing objects. Since there is no need to determine if the player has such weapons in his possession, that part of the code is not included. The rest of the code is almost identical to the “shoot” section:
IF{TEXT$=SWING}OR{TEXT$=HIT}OR{TEXT$=THROW}THEN
PRINT{......................................}
IF{ROBOT.HEAD>SCENE@}OR{ROBOT.POWER>SCENE@}THEN
PRINT{Don't damage the robot, it may be useful to you later!}
EXIT
SOUND{CLANG}
PRINT{Your attack fails to penetrate the robot's metal skin.}
PRINT{TOBOR: "Hey, don't mess up the paint job, stinkweed!"}
SOUND{PULSE.2}
PRINT{The robot fires a pulse beam at you, which stuns you and gives you a nastly burn.}
SOUND{OUCH}
LET{PHYS.HIT.CUR#=PHYS.HIT.CUR#-40}
EXIT
>>>When the player tries to swing his fist, a sword, a knife, or other weapon; or tries throw something at the robot, the first nested statement determines if the robot’s head and power unit are both in place. If either of them is not in place, the text tells the player not to damage the robot. If they are BOTH in place, that statement is skipped and the attack is executed. In this case, the attack proves futile, and the robot’s counter-attack damages the player’s hit points.
It is possible to have the target of the player’s attack suffer damage or death too, but I did not include that in this simple game. It is also possible to add a random element of chance to both attack and counter-attack, to cause occasional misses. You can even use a variable to keep track of and reduce the player’s ammunition. All these have been left out for purposes of simplicity.<<<
This next very brief statement simply prints a seperation line of periods before the object descriptions are printed, whenever the player clicks on the immobile objects in the scene.
The section of code below is used to provide changing information when the player clicks on the robot:
IF{CLICK$=ROBOT.BODY}THEN
IF{ROBOT.HEAD>SCENE@}THEN
PRINT{The robot's body is too heavy to be moved. The robot is missing its head.}
IF{ROBOT.POWER>SCENE@}THEN
PRINT{There is a rectangular hole in the robot's chest. Some component seems to be missing.}
EXIT
EXIT
IF{ROBOT.POWER>SCENE@}THEN
PRINT{There is a rectangular hole in the robot's chest. Some component seems to be missing, perhaps the power supply.}
EXIT
PRINT{TOBOR: "Hey cut it out, that tickles!"}
EXIT
>>>The first statement above detects when the player clicks on the robot’s body, an object called “ROBOT.BODY.” If this is true, then a nested statement determines if the robot’s head has not been installed. If not, then text is printed telling the player that the robot is too heavy to move, and that its head is missing. Another statement nested in that one checks to see if the power unit has been installed, and if not, tells the player that a component is missing.
If the head is in place, the “head” statement is ignored, and another statement tests to see if the power unit is in place. If not, then the player is told that the robot’s power unit is missing.
If both the head the power unit are in place, then both nested statements are ignored, and text is printed which gives the robot’s response to being touched.<<<
The section below is long, but not very complex. It handles the robot’s conversation with the player. In this case, the player just enters the word “talk” when he wants to get information from the robot. “Talk” is the standard command used in these situations, however some players may use “ask” or “info,” so those are include too, and are treated the same as “talk.” The first two nested statements check to see if the head and power unit have been installed. If either one is missing, then teh player is informed that this is the reason the robot cannot respond:
IF{TEXT$=TALK}OR{TEXT$=ASK}OR{TEXT$=INFO}THEN
PRINT{......................................}
IF{ROBOT.HEAD>SCENE@}THEN
PRINT{The robot can't talk, it doesn't have a head.}
EXIT
IF{ROBOT.POWER>SCENE@}THEN
PRINT{The robot is lifeless. It needs a power unit.}
EXIT
IF{T1#<1}THEN
PRINT{TOBOR: "Thanks for putting my head back, and restoring my power! I've been sitting there an awfully long time.}
PRINT{"My hoverskirt is still damaged though, so I can't move. But there's nothing you can do about that.}
PRINT{"By the way, I'm an object. Like the guy at the beginning of the game, my actions are controlled by the scene code. That's what allows me to talk to you. I can defend myself too, if you are so foolish as to attack me!}
PRINT{"But I'd much rather talk."}
LET{T1#=1}
EXIT
IF{T1#=1}THEN
PRINT{TOBOR: "Well let's see... oh yeah. I was supposed to tell you that only the full moon can provide the combination to the safe.}
PRINT{"I have no idea what that means. Ray just wanted me to tell you that. See, it's in the script.}
PRINT{"It's pretty boring just sitting here all the time. I wish Ray had given me a working hoverskirt."}
PRINT{"But it could be worse. At least I'm not stranded on a satellite and forced to watch bad movies. If I had to sit through Mitchell or Manos: The Hands of Fate, I'd tear my own head off!"}
LET{T1#=2}
EXIT
IF{T1#=2}THEN
PRINT{TOBOR: "If you see a rocket anywhere, you should say the magic word. For some reason that's pretty important.}
PRINT{"I don't remember what the magic word is. I'll have to search my data files and see if I can find it. Maybe by the time you talk to me again I might be able to remember it."}
LET{T1#=3}
EXIT
IF{T1#=3}THEN
PRINT{TOBOR: "Sorry, I still can't remember the magic word. But it's a four letter word that starts with H.}
PRINT{"And there should be some kind of clue about it in a nearby scene.}
PRINT{"One more thing you should know: A User Variable keeps track of my conversation with you, so that each time you talk to me I'll say something new, instead of the same thing over and over."}
LET{T1#=4}
EXIT
IF{T1#=4}THEN
PRINT{TOBOR: "Sorry, I've run out of things to say. I wish I was more like TV's wisecracking Crow, or the urbane Tom Servo. Those two are never at a loss for words!}
PRINT{"I especially wish I had Tom's singing voice! Not to mention his great dance moves. For a guy with a hoverskirt and useless arms, he sure can cut a rug!"}
LET{T1#=5}
EXIT
PRINT{TOBOR: "Sorry pal, I haven't heard anything new."}
EXIT
>>>In the above section, a variable (T1#) is used to keep track of how many times the player has talked to the robot. The first time the player enters “talk,” the variable has not yet been set, and so it is less then one. A nested statement checks for this condition, and if it is true, then the robot’s first speech is printed, and the variable is updated to equal one, using the LET command.
Each of the remaining statements test for the value of T1#, and when each statement is true, the appropriate text is printed, and the variable is incremented upward. Finally, when the robot has nothing new to say, the variable is allowed to remain constant, and any further attempts to talk to the robot will always receive the same reply, “Sorry pal, I haven’t heard anything new.”<<<
The code below handles the player’s attempts to give things to the robot. The first two nested statements test to see if the head and unit are installed. If not, then the text is printed which informs the player of this. The third nested statement determines whether the player has also entered the words “ram” or “chip.” If so, then another statement nested in that one checks to see if the player actually has the RAMchip. If he doesn’t have it, then some text is printed telling the player that he doesn’t have the RAMchip, and that the robot would like to have one. If he does have the chip, that statement is ignored, and the program continues with the exchange. The RAMchip is moved to storage, and the variable X1# is increased to ten. This is the variable I used to keep track of how much money the player has. Then text is printed, telling the player that the robot has accepted the chip, and has given him some cash for it.
IF{TEXT$=OFFER}OR{TEXT$=GIVE}THEN
PRINT{......................................}
IF{ROBOT.HEAD>SCENE@}THEN
PRINT{The robot can't take anything from you, since it doesn't have a head.}
EXIT
IF{ROBOT.POWER>SCENE@}THEN
PRINT{The robot is lifeless and can't take anything from you.}
EXIT
IF{TEXT$=RAM}OR{TEXT$=CHIP}THEN
IF{RAMCHIP>PLAYER@}THEN
PRINT{TOBOR: "Hey, you don't have any RAMchips! Don't tease me like that!"}
EXIT
MOVE{RAMCHIP}TO{STORAGE@}
LET{X1#=10}
PRINT{TOBOR: "Wow, thanks pal! Man, I love those things! Here, let me give you a little something for that."}
PRINT{Tobor takes the RAMchip and swallows it eagerly, then hands you some coins. You now have $10!}
EXIT
PRINT{TOBOR: "No thanks, I couldn't really do anything with that. But I'd sure love some nice crunchy RAMchips!"}
EXIT
>>>If the player tries to give the robot anything other than the chip, the “chip” statement is ignored, and text is printed telling the player that the robot has rejected his offer, and would rather have a RAMchip.<<<